﻿using CatUtils.Utils.Helper;
using HostsTool.Currency;
using HostsTool.Currency.IoUtils;
using System.Collections.Generic;

namespace HostsTool.Utils
{
    internal class DnsStartivalue
    {
        /// <summary>
        /// 用户自定义DNS
        /// </summary>
        public static string LocalDNSFile = StaticValue.BinPath + "Userdns.txt";

        /// <summary>
        /// 初始化dnslist
        /// </summary>
        /// <returns></returns>
        public static List<string> InitDnsList()
        {
            List<string> TempList = new List<string>();

            foreach (string Line in FileHelper.ReadAllLine(LocalDNSFile))
            {
                string DNSIP = TextHelper.RegexText(Line, "[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}").Trim();
                if (DNSIP != "")
                    TempList.Add(DNSIP);
            }

            TempList.AddRange(new List<string>() { "202.141.178.13", "101.132.183.99", "193.112.15.186", "123.207.56.160" });

            return TempList;
        }
    }
}